package com.sinszm.wx.pay;

import com.sinszm.common.exception.ApiException;
import com.sinszm.wx.protocol.Wx;

import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.util.List;

import static com.sinszm.wx.exception.WxApiError.WX_PAY_ERROR_001;

/**
 * 支付通用接口定义
 *
 * @author chenjianbo
 */
public interface PayApi {

    /**
     * 支付结果通知
     * @param request
     * @param payReq
     */
    default Wx.Bean.PayResp notificationPaymentResult(HttpServletRequest request, Wx.Bean.PayReq payReq){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /** ---------------------------- 华丽的分隔线 ---------------------------- **/

    /**
     * 统一下单
     * @param payReq
     * @param scene
     * @param scenePro
     */
    default Wx.Bean.PayResp unifiedorder(Wx.Bean.PayReq payReq, Wx.Bean.SceneInfo scene, Wx.Bean.SceneInfoPro scenePro){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * 查询订单
     * @param payReq
     */
    default Wx.Bean.PayResp orderquery(Wx.Bean.PayReq payReq){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * 关闭订单
     * @param payReq
     */
    default Wx.Bean.PayResp closeorder(Wx.Bean.PayReq payReq){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * 申请退款
     * @param payReq
     * @param cert
     */
    default Wx.Bean.PayResp refund(Wx.Bean.PayReq payReq, InputStream cert){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * 查询退款
     * @param payReq
     */
    default Wx.Bean.PayResp refundquery(Wx.Bean.PayReq payReq){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * 交易保障
     * @param payReq
     * @param trades
     */
    default Wx.Bean.PayResp report(Wx.Bean.PayReq payReq, List<Wx.Bean.Trades> trades){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * 拉取订单评价数据
     * @param payReq
     * @param cert
     */
    default Wx.Bean.PayResp batchquerycomment(Wx.Bean.PayReq payReq, InputStream cert){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * TODO 提交付款码支付
     * @param payReq
     * @param scene
     * @param scenePro
     */
    default Wx.Bean.PayResp micropay(Wx.Bean.PayReq payReq, Wx.Bean.SceneInfo scene, Wx.Bean.SceneInfoPro scenePro){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * TODO 撤销订单
     * @param payReq
     * @param cert
     */
    default Wx.Bean.PayResp reverse(Wx.Bean.PayReq payReq, InputStream cert){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * TODO 授权码查询openid
     * @param payReq
     */
    default Wx.Bean.PayResp authcodetoopenid(Wx.Bean.PayReq payReq){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * TODO 转换短链接
     * @param payReq
     */
    default Wx.Bean.PayResp shorturl(Wx.Bean.PayReq payReq){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * TODO 企业付款到零钱
     * @param payReq
     * @param cert
     */
    default Wx.Bean.PayResp transfers(Wx.Bean.PayReq payReq, InputStream cert){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * TODO 企业付款到零钱查询
     * @param payReq
     * @param cert
     */
    default Wx.Bean.PayResp gettransferinfo(Wx.Bean.PayReq payReq, InputStream cert){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * TODO 获取RSA加密公钥API
     * @param payReq
     * @param cert
     */
    default Wx.Bean.PayResp getpublickey(Wx.Bean.PayReq payReq, InputStream cert){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * TODO 企业付款到银行卡
     * @param payReq
     * @param cert
     */
    default Wx.Bean.PayResp pay_bank(Wx.Bean.PayReq payReq, InputStream cert){
        throw new ApiException(WX_PAY_ERROR_001);
    }

    /**
     * TODO 企业付款到银行卡查询
     * @param payReq
     * @param cert
     */
    default Wx.Bean.PayResp query_bank(Wx.Bean.PayReq payReq, InputStream cert){
        throw new ApiException(WX_PAY_ERROR_001);
    }

}